<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:insert="~{common/header::head}"></th:block>
    <link rel="stylesheet" type="text/css" th:href="@{/css/main.css}">
    <title th:text="${authorName}+'的诗词-云沾衣诗词网-入云深处亦沾衣'">云沾衣-入云深处亦沾衣</title>
</head>
<body>
<div th:insert="~{common/header :: home_nav}"></div>
<div class="container full">
    <div class="row">
        <div class="col col-sm-12 col-lg-9">
            <div class="m-2">
                <ul class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/">首页</a></li>
                    <li class="breadcrumb-item"><a href="/index/author">作者索引</a></li>
                    <li class="breadcrumb-item"><a th:href="@{'/author/'+${authorId}}" th:text="${authorName}">Italy</a></li>
                    <li class="breadcrumb-item active" th:text="${authorName}+'的作品'"></li>
                </ul>
            </div>
            <th:block th:each="poetry : ${dataInfo.getList()}">
                <div class="card">
                    <div class="card-body">
                        <a th:href="@{'/poetry/'+${poetry.poetryId}}">
                            <div style="font-size: x-large" th:text="${poetry.poetryTitle}"></div>
                        </a>
                        <div style="margin-top: 20px;margin-bottom: 20px ">
                            [<a style="color: #580000" target="_blank" th:href="@{/index/poetry/(dynasty=${poetry.dynastyId})}" th:text="${poetry.poetryDynasty}"></a>]
                            <a style="color: #580000" th:href="@{'/author/'+${poetry.authorId}}" th:text="${poetry.poetryAuthor}"
                            ></a>
                        </div>
                        <div style="font-size: large; line-height: 1.5;">
                    <span th:text="${poetry.poetryContent}" style="white-space: pre-wrap;">
                    </span>
                        </div>

                        <div style="margin-top: 20px">
                            <th:block th:each="tag : ${poetry.tagList}">
                                <a th:href="@{/index/poetry(tag=${tag.tagId})}"
                                   th:text="${tag.tagName}" class="badge rounded-pill btn-primary">成功</a>
                            </th:block>
                        </div>
                    </div>
                </div>
            </th:block>
            <!--分页-->
            <th:block th:if="${ dataInfo.getPages()> 1}">
                <ul class="pagination justify-content-center">
                    <!--总页数小于7-->
                    <th:block th:if="${dataInfo.getPages() < 7}" th:each="page:${dataInfo.getNavigatepageNums()}">
                        <li th:class="${page == dataInfo.getPageNum() ? 'page-item active':'page-item'}">
                            <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${page})}"
                               class="page-link" th:text="${page}"></a>
                        </li>
                    </th:block>
                    <th:block th:if="${dataInfo.getPages()>= 7}">
                        <!--当前页小于4-->
                        <th:block th:if="${dataInfo.getPageNum() < 4}">
                            <!--前3页-->
                            <th:block th:each="page:${#numbers.sequence(1,3)}">
                                <li th:class="${page == dataInfo.getPageNum() ? 'page-item active':'page-item'}">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${page})}"
                                       class="page-link" th:text="${page}"></a>
                                </li>
                            </th:block>
                            <!--4、5页-->
                            <li class="page-item">
                                <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${4})}"
                                   class="page-link">4</a>
                            </li>
                            <!--分隔符-->
                            <li class="page-item mx-2" disabled="">...</li>
                            <!--最后页-->
                            <li class="page-item">
                                <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPages()})}"
                                   class="page-link" th:text="${dataInfo.getPages()}"></a>
                            </li>
                            <li class="page-item"><a
                                    th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()+1})}"
                                    class="page-link">&gt;</a></li>
                            <th:block th:if="${dataInfo.getPages()-dataInfo.getPageNum() > 10}">
                                <li class="page-item"><a
                                        th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()+10})}"
                                        class="page-link">&raquo;</a></li>
                            </th:block>
                        </th:block>

                        <th:block th:if="${dataInfo.getPageNum() >= 4}">
                            <!--当前页小于等于倒数第4-->
                            <th:block th:if="${dataInfo.getPageNum() <= dataInfo.getPages() - 4}">
                                <th:block th:if="${dataInfo.getPageNum() > 10}">
                                    <li class="page-item"><a
                                            th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()-10})}"
                                            class="page-link">&laquo;</a>
                                    </li>
                                </th:block>
                                <li class="page-item"><a
                                        th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()-1})}"
                                        class="page-link">&lt;</a></li>
                                <!--第1页-->
                                <li class="page-item">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${1})}"
                                       class="page-link">1</a>
                                </li>
                                <!--分隔符-->
                                <li class="page-item mx-2" disabled="">...</li>

                                <li class="page-item">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()-1})}"
                                       class="page-link" th:text="${dataInfo.getPageNum() - 1}"></a>
                                </li>
                                <li class="page-item active">
                                    <a class="page-link" th:text="${dataInfo.getPageNum()}"></a>
                                </li>
                                <li class="page-item">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()+1})}"
                                       class="page-link" th:text="${dataInfo.getPageNum() + 1}"></a>
                                </li>
                                <!--分隔符-->
                                <li class="page-item mx-2" disabled="">...</li>
                                <!--最后页-->
                                <li class="page-item">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPages()})}"
                                       class="page-link" th:text="${dataInfo.getPages()}"></a>
                                </li>
                                <li class="page-item"><a
                                        th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()+1})}"
                                        class="page-link">&gt;</a></li>
                                <th:block th:if="${dataInfo.getPages()-dataInfo.getPageNum() > 10}">
                                    <li class="page-item"><a
                                            th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()+10})}"
                                            class="page-link">&raquo;</a>
                                    </li>
                                </th:block>
                            </th:block>
                        </th:block>
                        <!--当前页大于等于4-->
                        <th:block th:if="${dataInfo.getPageNum() > dataInfo.getPages() - 4}">
                            <th:block th:if="${dataInfo.getPageNum() > 10}">
                                <li class="page-item"><a
                                        th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()-10})}"
                                        class="page-link ">&laquo;</a></li>
                            </th:block>
                            <li class="page-item"><a
                                    th:href="@{'/author/poetry/'+${authorId}(pageNum=${dataInfo.getPageNum()-1})}"
                                    class="page-link">&lt;</a></li>
                            <!--第1页-->
                            <li class="page-item">
                                <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${1})}"
                                   class="page-link">1</a>
                            </li>
                            <!--分隔符-->
                            <li class="page-item mx-2" disabled="">...</li>
                            <!--后5页-->
                            <th:block
                                    th:each="page:${#numbers.sequence(dataInfo.getPages() - 3,dataInfo.getPages())}">
                                <li th:class="${page == dataInfo.getPageNum() ? 'page-item active':'page-item'}">
                                    <a th:href="@{'/author/poetry/'+${authorId}(pageNum=${page})}"
                                       class="page-link" th:text="${page}"></a>
                                </li>
                            </th:block>
                        </th:block>
                    </th:block>
                </ul>
            </th:block>
        </div>
        <div class="col-sm-auto col-lg-3">
            <div th:insert="~{common/common::ghcard}"></div>
        </div>
    </div>
</div>
<div th:insert="~{common/footer ::home-footer}"></div>
</body>
</html>
